var pics = {
  "data": [
      /*{"src": "images/pic/1.jpg",   "alt": "紫霞仙子和至尊宝",},
      {"src": "images/pic/2.jpg",   "alt": "紫霞仙子"}*/
   ]};
layui.config({
    base: './js/' //你的扩展模块所在目录
}).use(['jquery','flow','ajaxRequest'], function () {
	var $ = layui.jquery;
	// 流加载 图片
    var flow = layui.flow;
    var ajaxRequest = layui.ajaxRequest;

    var count = pics.data.length-1;
    flow.load({
    	elem: '.mixed-main', //流加载容器
    	isAuto: true,
    	end: '没有更多的图片了~QAQ',
    	done: function(page,next) {
    		var lis = [];

    		// 请求文件数据
            var res = ajaxRequest.sendGet("/admin/file/getCategoryList",{'page':page,'limit':8},false,false);

            if (res) {
                var total = res.count;
                var list = res.data;

                $.each(list, function (index, element) {

                    element.src = 'images/filetype/'+element.image;
                    element.alt = element.title;

                    lis.push('<div class="mixed shadow animated zoomIn">'+
                        '<div class="mixed-pic">'+
                        '<a href="javascript:void(0)"><img src="images/filetype/'+element.image+'" alt="'+element.title+'" /></a>'+
                        '</div>'+
                        '<div class="mixed-info">'+element.title+'</div>'+
                        '<div class="mixed-footer">'+
                        // '<a class="layui-btn layui-btn-small layui-btn-primary" href="javascript:view('+index+')"><i class="fa fa-eye fa-fw"></i>查看</a>'+
                        '<a class="layui-btn layui-btn-small layui-btn-primary" href="'+baseUrl+'/file/downloadFile?path='+element.filePath+'&name='+element.title+'"><i class="fa fa-download fa-fw"></i>下载</a>'+
                        '</div>',
                        '</div>');
                });

                pics.data.push(list);

                next(lis.join(''), page < Math.ceil(total/8));
            }

    		/*for (var i=0; i<8; i++) {
    			if (count < -1) break;
    			if (count==-1) {
    				lis.push('<div class="mixed shadow animated zoomIn">'+
    	                 '<div class="mixed-pic">'+
    	                    '<a href="javascript:"><img src="images/pic/0.jpg" alt="图片还在拍摄中" /></a>'+
	                    '</div>'+
	                    '<div class="mixed-info">图片还在拍摄中</div>'+
	                    '<div class="mixed-footer">'+
	                        '<a class="layui-btn layui-btn-small layui-btn-primary layui-btn-disabled"><i class="fa fa-eye fa-fw"></i>查看</a>'+
	                        '<a class="layui-btn layui-btn-small layui-btn-primary layui-btn-disabled"><i class="fa fa-download fa-fw"></i>下载</a>'+
	                    '</div>',
	                '</div>');
    			} else {

    			}
    			count--;
    		}
    		next(lis.join(''), page < pics.data.length/8);*/
    	}
    });
});
function view(start) {
    debugger;
	pics.start = start;
	layer.photos({photos: pics });	
}

    $(function () {
        $(".fa-paper-plane-o").parent().parent().addClass("layui-this");
    });